<?php

namespace App\Controller;

use App\Middleware\Auth\UserAuthMiddleware;
use App\Resource\User;
use App\serve\UserServe;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\GetMapping;
use Hyperf\HttpServer\Annotation\Middleware;

#[Controller]
#[Middleware(UserAuthMiddleware::class)]
class UserController extends AbstractController
{

    /**
     * @var UserServe
     */
    #[Inject]
    public UserServe $userServe;


    #[GetMapping('/user/info')]
    public function user()
    {
        return User::collection($this->userServe->userList())->additional(['code'=>200]);
    }

}